<script language="javascript">
/*™*******************************************************************************************™*/

$().ready(function() {

	$("#TXTdoc_no_from").numeric();
	$("#TXTdoc_no_to").numeric();
	
	// slide panel
	//$(".btn-slide").click(function(){
		$("#panel").slideToggle("fast");
		$(this).toggleClass("active"); 
		//return false;
	//});

	$("#BTTtruncate").click(function(){
		var handel = confirm("All Data will be Delete from System. Are you sure ?");
		if (handel == true) {
		  return true;
		} else {
		  return false;
		}
	});

	$("#BTTexecute").click(function(){
		var handel = confirm("You must TRUNCATE TABLE before peocess. Yes or No ?");
		if (handel == true) {
		  return false;
		} else {
		  return true;
		}
	});
		
});

/*™*******************************************************************************************™*/

$().ready(function() {
	
	// css focus field
	$("input:text, select").livequery("focus", function() {
		$(this).addClass("input_focus");
	});

	$("input:text, select").livequery("blur", function() {
		$(this).removeClass("input_focus");
	});

});

/*™*******************************************************************************************™*/

$().ready(function() {

	/* submit form */
	var options = {
		dataType: "json",
		beforeSubmit: showRequest,
		success: showResponse
	}
	
	$("form").ajaxForm(options);
	
	return false;  // always return false to prevent std. browser submit and page navigation
	
});

/*™*******************************************************************************************™*/

function showRequest(formData, jqForm, options) {

	/* blockUI plugin */
	jQuery.blockUI({
		message: "<div id='divLoading'>Please wait ...</div>",
		css: { 
			border: "none", 
			padding: "15px", 
			backgroundColor: "#000000", "-webkit-border-radius": "10px", "-moz-border-radius": "10px", 
			opacity: "0.5", 
			color: "#ffffff" 
		}
	});

}

/*™*******************************************************************************************™*/

function showResponse(responseText, statusText) {

	jQuery.unblockUI();
	
	$.each(responseText, function(key, value) { // json format
		if (key == "POSTING_SUCCESS") {
			alert(value);
		} else if (key == "POSTING_REDIRECT") {
			window.location.href = unescape(value);
		} else {
			alert(value);		
		}
	});
	
}

/*™*******************************************************************************************™*/
</script>
